/**
 * 
 */
package uit.comstore.model.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author XIII
 *
 */
@Entity
@Table(name="BillsDetails")
@SuppressWarnings("serial")
public class BillDetail implements Serializable {
	
	private Long id;
	private Integer productQuantity;
	private BigDecimal productPrice;
	private BigDecimal total;
	
	private Product product;
	private Bill bill;
	
	@Id
	@GeneratedValue
	@Column(name="BillsDetailsId")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name="ProductsQuantity")
	public Integer getProductQuantity() {
		return productQuantity;
	}
	public void setProductQuantity(Integer productQuantity) {
		this.productQuantity = productQuantity;
	}
	
	@Column(name="ProductsPrice")
	public BigDecimal getProductPrice() {
		return productPrice;
	}
	public void setProductPrice(BigDecimal productPrice) {
		this.productPrice = productPrice;
	}
	
	@Column(name="FinalPrice")
	public BigDecimal getTotal() {
		return total;
	}
	public void setTotal(BigDecimal total) {
		this.total = total;
	}
	
	@ManyToOne(cascade=CascadeType.MERGE)
	@JoinColumn(name="ProductsId", referencedColumnName="ProductsId")
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	
	@ManyToOne(cascade=CascadeType.MERGE)
	@JoinColumn(name="BillsId", referencedColumnName="BillsId")
	public Bill getBill() {
		return bill;
	}
	public void setBill(Bill bill) {
		this.bill = bill;
	}
}
